from manimlib import *


class TestGl(Scene):
    def construct(self):
        sq = Square(side_length=6, fill_opacity=1, stroke_width=0)
        sq.set_color_by_code("""
            color.a=2.0/length(point);
        """)
        self.add(sq)


# 😄  💧

class Emoji(Scene):
    def construct(self):
        one_pair = Group(
            # Text("😄", font="Segoe UI Emoji"),
            # Text("💧", font="Segoe UI Emoji")
            ImageMobject("./assets/smile.png").set_height(0.5),
            ImageMobject("./assets/sweat.png").set_height(0.5),
        ).arrange(RIGHT, buff=1.4)
        n = 40
        horizontal_ratio = 9
        # all_pairs = VGroup(*[
        #     one_pair.copy().rotate(i * 10 / PI)
        #     for i in range(10)
        # ])
        all_pairs = Group()
        for i in range(n):
            all_pairs.add(
                one_pair.copy().rotate(i / PI).shift(
                    UP * 6 + LEFT * horizontal_ratio / 2 + i * DOWN * 0.3 + i * RIGHT / n * horizontal_ratio)
            )
        self.add(all_pairs)
        self.play(*[
            Rotating(all_pairs[i], angle=2 * TAU, about_point=all_pairs[i].get_center())
            for i in range(len(all_pairs))
        ], run_time=10)


# class TestImage(Scene):
#     def construct(self):
#         smile = ImageMobject("./assets/smile.png")
#         self.add(smile)
